<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// Add Tooltip & Pane library
JHtml::_('behavior.mootools');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.modal');
jimport('joomla.html.pane');

// Add javascripts & stylesheet
$document =& JFactory::getDocument();

switch ($this->map) {
	case "swisstopo":
		$document->addScript("http://api.geo.admin.ch/loader.js");
		$document->addScript(JURI::base().'components/com_geotrails/assets/js/swisstopo.js');
		break;
		
	case "gmap":
		$document->addScript("http://maps.google.com/maps/api/js?sensor=true");
		$document->addScript(JURI::base().'components/com_geotrails/assets/js/gmap.js');
		break;

	default:
		$document->addScript("http://mapapi.swissgeo.ch/swissgeoMKey.api");
		$document->addScript("http://maps.google.com/maps/api/js?sensor=true");
		$document->addScript(JURI::base().'components/com_geotrails/assets/js/swissgeo.js');
		break;
}

// Css
$document->addStyleSheet(JURI::base().'components/com_geotrails/assets/css/style.css');
?>
<div style="clear:both;"></div>
<div id="com_geotrails">
	<div class="com_geotrails_fiche">
		<div id="com_geotrails_loading"></div>
		<div id="com_geotrails_content">
			<div class="toolbar_fiche">
			<?php echo JHtml::tooltip(JText::_('COM_GEOTRAILS_PRINT'), JText::_('COM_GEOTRAILS_PRINT'), JURI::root().'components/com_geotrails/assets/images/printer.png', '', 'javascript:print();', false); ?>
			<?php echo JHtml::tooltip(JText::_('COM_GEOTRAILS_PRINT_PDF_TEXT'), JText::_('COM_GEOTRAILS_PRINT_PDF'), JURI::root().'components/com_geotrails/assets/images/pdf.png', '', $this->api_url_pdf.$this->fiche["id"], false); ?>
			<?php echo JHtml::tooltip(JText::_('COM_GEOTRAILS_VIEW_FACEBOOK_TEXT'), JText::_('COM_GEOTRAILS_VIEW_FACEBOOK'), JURI::root().'components/com_geotrails/assets/images/facebook.png', '', $this->api_url_fb.$this->fiche["id"], false); ?>
			<?php echo JHtml::tooltip(JText::_('COM_GEOTRAILS_GE_COORDINATES_TEXT'), JText::_('COM_GEOTRAILS_GE_COORDINATES'), JURI::root().'components/com_geotrails/assets/images/google_earth.png', '', $this->api_url_kmz.$this->fiche["id"], false); ?>
			<?php echo JHtml::tooltip(JText::_('COM_GEOTRAILS_GPS_COORDINATES_TEXT'), JText::_('COM_GEOTRAILS_GPS_COORDINATES'), JURI::root().'components/com_geotrails/assets/images/gpx.png', '', $this->api_url_gpx.$this->fiche["id"], false); ?>
			<?php echo JHtml::tooltip(JText::_('COM_GEOTRAILS_VIEW_3D_TEXT'), JText::_('COM_GEOTRAILS_VIEW_3D'), JURI::root().'components/com_geotrails/assets/images/3d.png', '', $this->api_url_3d.$this->fiche["id"], false); ?>
			</div>
			<h2><?php echo JText::_($this->fiche->name); ?></h2>
			<h3><?php echo JText::_($this->fiche->long_title); ?></h3>
			<?php $pane =& JPane::getInstance('tabs'); ?>
			<?php echo $pane->startPane( 'pane' ); ?>
			<?php echo $pane->startPanel( JText::_('COM_GEOTRAILS_DESCRIPTION'), 'panel1' ); ?>
			<?php echo $this->loadTemplate('description'); ?>
			<?php echo $pane->endPanel(); ?>
			<?php echo $pane->startPanel( JText::_('COM_GEOTRAILS_DETAIL'), 'panel2' ); ?>
			<?php echo $this->loadTemplate('detail'); ?>
			<?php echo $pane->endPanel(); ?>
			<?php echo $pane->startPanel( JText::_('COM_GEOTRAILS_INFORMATION'), 'panel3' ); ?>
			<?php echo $this->loadTemplate('information'); ?>
			<?php echo $pane->endPanel(); ?>
			<?php echo $pane->startPanel( JText::_('COM_GEOTRAILS_PROFIL'), 'panel4' ); ?>
			<?php echo $this->loadTemplate('profil'); ?>
			<?php echo $pane->endPanel(); ?>
			<?php echo $pane->startPanel( JText::_('COM_GEOTRAILS_POIS'), 'panel5' ); ?>
			<?php echo $this->loadTemplate('pois'); ?>
			<?php echo $pane->endPanel(); ?>
			<?php if (count($this->images)) { ?>
			<?php echo $pane->startPanel( JText::_('COM_GEOTRAILS_MEDIA'), 'panel6' ); ?>
			<?php echo $this->loadTemplate('media'); ?>
			<?php echo $pane->endPanel(); ?>
			<?php } ?>
			<?php echo $pane->endPane(); ?>
			<?php echo $this->loadTemplate('map'); ?>
		</div>
	</div>
</div>
<script type="text/javascript">
	initialize('<?php echo $this->kml_file; ?>');
</script>